package edu.rpi.tw.escience.stargazer.client;

import com.google.gwt.core.client.*;
import com.google.gwt.user.client.*;
import com.google.gwt.user.client.rpc.*;
import com.google.gwt.user.client.ui.*;

import edu.rpi.tw.escience.stargazer.client.StargazerRemoteService;
import edu.rpi.tw.escience.stargazer.client.StargazerRemoteServiceAsync;

/**
 */
public class TextFieldWidget extends Composite {
  private StargazerRemoteServiceAsync reverserService = null;

  private Image loadingImg;
  private TextBox textBox;
 // private Button button;
  private HorizontalPanel basePanel;


  /**
   * Constructor
   */
  public TextFieldWidget(final String name, final String entry) {

	  
	  
    loadingImg = new Image("loading.gif");

 //   button = new Button();

    basePanel = new HorizontalPanel();

    textBox = new TextBox();
    textBox.setVisibleLength(15);
    textBox.setText(entry);

    // Call initWidget to set the widget to be wrapped by the composite.
    initWidget(basePanel);

    // Initialize the GWT UI elements that make up this Composite
    //initSimpleStringServicePanel();

    // Load the UI components in a deferred command
    DeferredCommand.addCommand(new Command() {
      public void execute() {
        initSimpleStringServicePanel(name);
      }
    });
  }

  public String getTextValue() {
	  return textBox.getText();
  }
  /**
   * Method used to intialize and place all the GWT UI elements that make up this composite
   */
  private void initSimpleStringServicePanel(String name) {
    // Style the widget

    // Add a label and textbox to the base panel
    basePanel.add(new Label(name + ":\t\t"));
    basePanel.add(textBox);


  }


 
}//end class StringReverserWidget
